package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonLessonDataBean;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;

import java.util.List;

/**
 * Created by hyy on 2018/1/23.
 * describe as
 */

public class SelectTextBookAdapter extends CommonRecycleViewAdapter<CartoonLessonDataBean.LessonSimpleVOsBean> {
    public SelectTextBookAdapter(Context mContext, List<CartoonLessonDataBean.LessonSimpleVOsBean> itemDatas) {
        super(mContext, R.layout.activity_cartoon_select_textbook_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CartoonLessonDataBean.LessonSimpleVOsBean item, int position) {

        TextView name = customViewHold.getView(R.id.name);
        name.setText(item.getLessonName());

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemCallBack != null) {
                    itemCallBack.itemCallBack(item);
                }
            }
        });


    }

    public void setItemCallBack(ItemCallBack itemCallBack) {
        this.itemCallBack = itemCallBack;
    }

    private ItemCallBack itemCallBack;

    public interface ItemCallBack {
        abstract void itemCallBack(CartoonLessonDataBean.LessonSimpleVOsBean item);
    }
}
